Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce dangling underscores in method names #1907

Merged
merged 1 commit into from
Sep 3, 2018
Merged

Enforce dangling underscores in method names #1907

merged 1 commit into from
Sep 3, 2018

Conversation

JBallin
Copy link
Contributor

@JBallin JBallin commented Sep 1, 2018

@ljharb updated the docs on 4/13/16 to forbid using underscores in method names, but the linter does not actually raise an error when defining a method with a dangling underscore.

// bad
this.__firstName__ = 'Panda';
this.firstName_ = 'Panda';
this._firstName = 'Panda';

// good
this.firstName = 'Panda';

@gabro added the ability to enforce underscores in method names to ESLint on 7/16/17. The rule was added to the linter's rules by @ljharb on 9/1/17, but was left as false instead of true, despite the TODO comment to 'enable' the rule (presumably this was human error).

Before most recent commit:

// enforceInMethodNames: false, // TODO: uncoment and enable, semver-minor once v3 is dropped

After most recent commit:

enforceInMethodNames: false,

After my commit:

enforceInMethodNames: true,

NOTE: The linter currently does complain when calling a method with a dangling underscore. This is addressing defining the method.

Copy link
Collaborator

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Indeed, this should have been enabled when v3 was dropped.

@ljharb ljharb merged commit 17e0454 into airbnb:master Sep 3, 2018
@JBallin JBallin deleted the enforce-no-underscore-methods branch September 3, 2018 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants